import { Module } from '@nestjs/common';
import { AppController } from './app.controller';
import { AppService } from './app.service';
import { routes } from '../router';
import { TypeOrmModule } from '@nestjs/typeorm';

@Module({
  imports: [...routes.map(it => it.module), TypeOrmModule.forRoot({
    type: 'mysql',
    host: '127.0.0.1',
    port: 3306,
    username: 'root',
    password: '',
    database: 'nest',
    logging: ['warn', 'error'],
    entities: [
      'dist/entity/**/*.js',
    ],
    migrations: [
      'dist/migration/**/*.js',
    ],
    synchronize: true,
    debug: false
  }),
  ],
  controllers: [AppController],
  providers: [AppService],
})
export class AppModule { }
